<template>
  <div class="container">
    <van-nav-bar title="隐私协议" left-arrow @click-left="onClickLeft" />
    <div v-html="richText" class="pl-5 pr-5 pb-10"></div>
  </div>
</template>

<script lang="ts" setup>
import { ref, onMounted } from "vue";
import { getInfo } from "@/api";
import { useRouter } from "vue-router";

const router = useRouter();
const name = ref("");
const richText = ref("");

onMounted(() => {
  name.value = router.currentRoute.value.query.name.toString();

  GetNameInfo(name.value);
});

const GetNameInfo = async (name: string) => {
  let data = await getInfo({
    agreementName: name
  });
  richText.value = data.agreementContent;
  console.log(data);
};

const onClickLeft = () => history.back();
</script>

<style scoped>
.login-container {
  padding: 20px;
}
</style>
